import { checkShop } from "@/apis/shop"
import { checkBill } from "@/apis/bill"
import { batchAddOrder } from "@/apis/order"
import dayjs from "dayjs"
export const format = {
	"账单编号": "bid",
	"订单编号": "orderId",
	"店铺名称": "shopName",
	"下单平台": "platform",
	"结算金额": "money",
	"实际付款金额": "amount",
	"下单用户": "nickname",
	"下单时间": "orderCreateTime",
	"小蚕报名时间": "orderCreateTime",
	"平台订单号": "orderNo",
}

export function cnKeyJson2en(arr){
	let result = []
	arr.forEach(item=>{
		let obj = {
			imgList:[]
		}
		console.log(item)
		for (const key in format) {
			if(item[key] && item[key] != "暂无"){
				if(obj[format[key]] instanceof Array){
					obj[format[key]].push(item[key])
				}else if(key == "下单时间"){
					obj[format[key]] = dayjs(item[key]).format("YYYY-MM-DD HH:mm:ss")
				}else if(key == "平台订单号"){
					let val = item[key]
					// debugger
					if(val.includes(":")){
						val = val.split(":")[1]
					}
					obj[format[key]] = val
				}
				// else if(key == "订单编号"){
				// 	// obj[format[key]] = item[key].replace(" .","")
				// }
				else{
					obj[format[key]] = item[key]
				}
			}
		}
		result.push(obj)
	})
	return result
}